<?php

namespace App\Http\Controllers\Mall;

use App\Traits\Mall\ItemTrait;
use Illuminate\Http\Request;

class ItemController extends BaseController
{
    use ItemTrait;

    /**
     * @param Request $request
     * @param \App\Models\Item $item
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    protected function showDetailView(Request $request, $item)
    {
        $itemid = $item->itemid;
        $hotSales = $item->shop->items()->orderByDesc('sold')->limit(5)->get();
        return $this->view('mall.item.detail', compact('item','hotSales', 'itemid'));
    }
}
